import request from '@/utils/request'
import qs from 'qs'


// 获取所有文章
export function getArticleList (pageNumber, pageSize) {
  return request({
    url: '/cms/article/list',
    method: 'get',
    params: {
      pageNumber,
      pageSize
    }
  })
}


// 添加文章
export function addArticle (data) {
  return request({
    url: '/cms/article/save',
    method: 'post',
    data: qs.stringify({
      categoryId: data.categoryId,
      }, {indices: false})
  })
}

// 删除文章
export function deleteArticles (ids) {
  return request({
    url: '/cms/article/delete',
    method: 'post',
    data: qs.stringify({
      ids
    }, {indices: false})
  })
}

// 编辑文章
export function updateArticle (article) {
  return request({
    url: '/cms/article/update',
    method: 'post',
    data: qs.stringify({
      id: article.articleId,
      categoryId: article.categoryId,
    }, {indices: false})
  })
}
